Debugging I2C GPIO

Perform the following steps to debug I2C:

  1. Execute the following command to scan the bus:
    i2cdetect -l
    Result:
    Figure 1. Example Output
  2. Execute the following command to detect the device:
    i2cdetect -y -r 0
    Tip:

    0 is the I2C bus number.

    Result:
    Figure 2. Example Output
    In this figure, the detected devices are 0x29, 0x48, 0x5c, 0x68, and 0x70.
  3. Execute the following command to read register content:
    i2cget -f -y 0 0x5c 0x0f
    Tip:
    • 0: I2C bus number
    • 0x5c: I2C device address
    • 0x0f: Memory address
    Result:
    Figure 3. Example Output

    The register content is 0xb1 in this output.

  4. Execute the following command to write register data:
    i2cset -y 0 0x5c 0x11 0x10
    Tip:
    • 0: I2C bus number.
    • 0x5c: I2C device address.
    • 0x11: Memory address.
    • 0x10: The content to be written in the register.
  5. Execute the following to read all register values:
    i2cdump -y 0 0x5c
    Tip:
    • 0: I2C bus number
    • 0x5c: I2C device address
    Result:
    Figure 4. Example Output